#include "stdafx.h"
#include "dendrite.h"
#include "Dendrite Form.h"

namespace SimpleGUI
{
	// Constructor and Destructor

	template <class T, class U> Dendrite<T, U>::Dendrite(nnse::dendrite<T, U>^ p)
	: parent(p)
	{
		InitializeComponent();
	};

	template <class T, class U> Dendrite<T, U>::~Dendrite()
	{
		if (components)
		{
			delete components;
		}
	};

	// GUI Functions

	template <class T, class U> System::Void Dendrite<T, U>::form_closed(System::Object^  sender, System::Windows::Forms::FormClosedEventArgs^  e)
	{
		parent->invalidate_form();
	};

	template <class T, class U> System::Void Dendrite<T, U>::update_form()
	{
		number_textBox->Text=parent->get_number().ToString();
		weight_textBox->Text=parent->get_weight().ToString();
		input_textBox->Text=parent->get_input().ToString();
		output_textBox->Text=parent->get_output().ToString();
		previous_weight_change_textBox->Text=parent->get_previous_weight_change().ToString();
		this->Refresh();
	};

	// Explicit Instantiation

	template ref class Dendrite<bool, double>;
	template ref class Dendrite<unsigned char, double>;
}
